﻿#region Using directives

using System;
using System.Data;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;

using GPSTrackingDBV2.Entities;
using GPSTrackingDBV2.Data;

#endregion

namespace GPSTrackingDBV2.Data.Bases
{	
	///<summary>
	/// This class is the base class for any <see cref="DepartmentsProviderBase"/> implementation.
	/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
	///</summary>
	public abstract partial class DepartmentsProviderBaseCore : EntityProviderBase<GPSTrackingDBV2.Entities.Departments, GPSTrackingDBV2.Entities.DepartmentsKey>
	{		
		#region Get from Many To Many Relationship Functions
		#region GetByAdminUsernameCompanyIdFromAdministratorsByDepartments
		
		/// <summary>
		///		Gets Departments objects from the datasource by AdminUsername in the
		///		AdministratorsByDepartments table. Table Departments is related to table Administrators
		///		through the (M:N) relationship defined in the AdministratorsByDepartments table.
		/// </summary>
		/// <param name="_adminUsername"></param>
		/// <param name="_companyId"></param>
		/// <returns>Returns a typed collection of Departments objects.</returns>
		public TList<Departments> GetByAdminUsernameCompanyIdFromAdministratorsByDepartments(System.String _adminUsername, System.Int32 _companyId)
		{
			int count = -1;
			return GetByAdminUsernameCompanyIdFromAdministratorsByDepartments(null,_adminUsername, _companyId, 0, int.MaxValue, out count);
			
		}
		
		/// <summary>
		///		Gets GPSTrackingDBV2.Entities.Departments objects from the datasource by AdminUsername in the
		///		AdministratorsByDepartments table. Table Departments is related to table Administrators
		///		through the (M:N) relationship defined in the AdministratorsByDepartments table.
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_adminUsername"></param>
		/// <param name="_companyId"></param>
		/// <remarks></remarks>
		/// <returns>Returns a TList of Departments objects.</returns>
		public TList<Departments> GetByAdminUsernameCompanyIdFromAdministratorsByDepartments(System.String _adminUsername, System.Int32 _companyId, int start, int pageLength)
		{
			int count = -1;
			return GetByAdminUsernameCompanyIdFromAdministratorsByDepartments(null, _adminUsername, _companyId, start, pageLength, out count);
		}
		
		/// <summary>
		///		Gets Departments objects from the datasource by AdminUsername in the
		///		AdministratorsByDepartments table. Table Departments is related to table Administrators
		///		through the (M:N) relationship defined in the AdministratorsByDepartments table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_adminUsername"></param>
		/// <param name="_companyId"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of Departments objects.</returns>
		public TList<Departments> GetByAdminUsernameCompanyIdFromAdministratorsByDepartments(TransactionManager transactionManager, System.String _adminUsername, System.Int32 _companyId)
		{
			int count = -1;
			return GetByAdminUsernameCompanyIdFromAdministratorsByDepartments(transactionManager, _adminUsername, _companyId, 0, int.MaxValue, out count);
		}
		
		
		/// <summary>
		///		Gets Departments objects from the datasource by AdminUsername in the
		///		AdministratorsByDepartments table. Table Departments is related to table Administrators
		///		through the (M:N) relationship defined in the AdministratorsByDepartments table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_adminUsername"></param>
		/// <param name="_companyId"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of Departments objects.</returns>
		public TList<Departments> GetByAdminUsernameCompanyIdFromAdministratorsByDepartments(TransactionManager transactionManager, System.String _adminUsername, System.Int32 _companyId,int start, int pageLength)
		{
			int count = -1;
			return GetByAdminUsernameCompanyIdFromAdministratorsByDepartments(transactionManager, _adminUsername, _companyId, start, pageLength, out count);
		}
		
		/// <summary>
		///		Gets Departments objects from the datasource by AdminUsername in the
		///		AdministratorsByDepartments table. Table Departments is related to table Administrators
		///		through the (M:N) relationship defined in the AdministratorsByDepartments table.
		/// </summary>
		/// <param name="_adminUsername"></param>
		/// <param name="_companyId"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of Departments objects.</returns>
		public TList<Departments> GetByAdminUsernameCompanyIdFromAdministratorsByDepartments(System.String _adminUsername, System.Int32 _companyId,int start, int pageLength, out int count)
		{
			
			return GetByAdminUsernameCompanyIdFromAdministratorsByDepartments(null, _adminUsername, _companyId, start, pageLength, out count);
		}


		/// <summary>
		///		Gets Departments objects from the datasource by AdminUsername in the
		///		AdministratorsByDepartments table. Table Departments is related to table Administrators
		///		through the (M:N) relationship defined in the AdministratorsByDepartments table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <param name="_adminUsername"></param>
		/// <param name="_companyId"></param>
		/// <remarks></remarks>
		/// <returns>Returns a TList of Departments objects.</returns>
		public abstract TList<Departments> GetByAdminUsernameCompanyIdFromAdministratorsByDepartments(TransactionManager transactionManager,System.String _adminUsername, System.Int32 _companyId, int start, int pageLength, out int count);
		
		#endregion GetByAdminUsernameCompanyIdFromAdministratorsByDepartments
		
		#region GetByCompanyIdFromCompaniesByDepartments
		
		/// <summary>
		///		Gets Departments objects from the datasource by CompanyID in the
		///		CompaniesByDepartments table. Table Departments is related to table Companies
		///		through the (M:N) relationship defined in the CompaniesByDepartments table.
		/// </summary>
		/// <param name="_companyId"></param>
		/// <returns>Returns a typed collection of Departments objects.</returns>
		public TList<Departments> GetByCompanyIdFromCompaniesByDepartments(System.Int32 _companyId)
		{
			int count = -1;
			return GetByCompanyIdFromCompaniesByDepartments(null,_companyId, 0, int.MaxValue, out count);
			
		}
		
		/// <summary>
		///		Gets GPSTrackingDBV2.Entities.Departments objects from the datasource by CompanyID in the
		///		CompaniesByDepartments table. Table Departments is related to table Companies
		///		through the (M:N) relationship defined in the CompaniesByDepartments table.
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_companyId"></param>
		/// <remarks></remarks>
		/// <returns>Returns a TList of Departments objects.</returns>
		public TList<Departments> GetByCompanyIdFromCompaniesByDepartments(System.Int32 _companyId, int start, int pageLength)
		{
			int count = -1;
			return GetByCompanyIdFromCompaniesByDepartments(null, _companyId, start, pageLength, out count);
		}
		
		/// <summary>
		///		Gets Departments objects from the datasource by CompanyID in the
		///		CompaniesByDepartments table. Table Departments is related to table Companies
		///		through the (M:N) relationship defined in the CompaniesByDepartments table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_companyId"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of Departments objects.</returns>
		public TList<Departments> GetByCompanyIdFromCompaniesByDepartments(TransactionManager transactionManager, System.Int32 _companyId)
		{
			int count = -1;
			return GetByCompanyIdFromCompaniesByDepartments(transactionManager, _companyId, 0, int.MaxValue, out count);
		}
		
		
		/// <summary>
		///		Gets Departments objects from the datasource by CompanyID in the
		///		CompaniesByDepartments table. Table Departments is related to table Companies
		///		through the (M:N) relationship defined in the CompaniesByDepartments table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_companyId"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of Departments objects.</returns>
		public TList<Departments> GetByCompanyIdFromCompaniesByDepartments(TransactionManager transactionManager, System.Int32 _companyId,int start, int pageLength)
		{
			int count = -1;
			return GetByCompanyIdFromCompaniesByDepartments(transactionManager, _companyId, start, pageLength, out count);
		}
		
		/// <summary>
		///		Gets Departments objects from the datasource by CompanyID in the
		///		CompaniesByDepartments table. Table Departments is related to table Companies
		///		through the (M:N) relationship defined in the CompaniesByDepartments table.
		/// </summary>
		/// <param name="_companyId"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of Departments objects.</returns>
		public TList<Departments> GetByCompanyIdFromCompaniesByDepartments(System.Int32 _companyId,int start, int pageLength, out int count)
		{
			
			return GetByCompanyIdFromCompaniesByDepartments(null, _companyId, start, pageLength, out count);
		}


		/// <summary>
		///		Gets Departments objects from the datasource by CompanyID in the
		///		CompaniesByDepartments table. Table Departments is related to table Companies
		///		through the (M:N) relationship defined in the CompaniesByDepartments table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <param name="_companyId"></param>
		/// <remarks></remarks>
		/// <returns>Returns a TList of Departments objects.</returns>
		public abstract TList<Departments> GetByCompanyIdFromCompaniesByDepartments(TransactionManager transactionManager,System.Int32 _companyId, int start, int pageLength, out int count);
		
		#endregion GetByCompanyIdFromCompaniesByDepartments
		
		#region GetByUserGroupIdFromUsersGroupsByDepartments
		
		/// <summary>
		///		Gets Departments objects from the datasource by UserGroupID in the
		///		UsersGroupsByDepartments table. Table Departments is related to table UsersGroups
		///		through the (M:N) relationship defined in the UsersGroupsByDepartments table.
		/// </summary>
		/// <param name="_userGroupId"></param>
		/// <returns>Returns a typed collection of Departments objects.</returns>
		public TList<Departments> GetByUserGroupIdFromUsersGroupsByDepartments(System.Int32 _userGroupId)
		{
			int count = -1;
			return GetByUserGroupIdFromUsersGroupsByDepartments(null,_userGroupId, 0, int.MaxValue, out count);
			
		}
		
		/// <summary>
		///		Gets GPSTrackingDBV2.Entities.Departments objects from the datasource by UserGroupID in the
		///		UsersGroupsByDepartments table. Table Departments is related to table UsersGroups
		///		through the (M:N) relationship defined in the UsersGroupsByDepartments table.
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_userGroupId"></param>
		/// <remarks></remarks>
		/// <returns>Returns a TList of Departments objects.</returns>
		public TList<Departments> GetByUserGroupIdFromUsersGroupsByDepartments(System.Int32 _userGroupId, int start, int pageLength)
		{
			int count = -1;
			return GetByUserGroupIdFromUsersGroupsByDepartments(null, _userGroupId, start, pageLength, out count);
		}
		
		/// <summary>
		///		Gets Departments objects from the datasource by UserGroupID in the
		///		UsersGroupsByDepartments table. Table Departments is related to table UsersGroups
		///		through the (M:N) relationship defined in the UsersGroupsByDepartments table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_userGroupId"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of Departments objects.</returns>
		public TList<Departments> GetByUserGroupIdFromUsersGroupsByDepartments(TransactionManager transactionManager, System.Int32 _userGroupId)
		{
			int count = -1;
			return GetByUserGroupIdFromUsersGroupsByDepartments(transactionManager, _userGroupId, 0, int.MaxValue, out count);
		}
		
		
		/// <summary>
		///		Gets Departments objects from the datasource by UserGroupID in the
		///		UsersGroupsByDepartments table. Table Departments is related to table UsersGroups
		///		through the (M:N) relationship defined in the UsersGroupsByDepartments table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_userGroupId"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of Departments objects.</returns>
		public TList<Departments> GetByUserGroupIdFromUsersGroupsByDepartments(TransactionManager transactionManager, System.Int32 _userGroupId,int start, int pageLength)
		{
			int count = -1;
			return GetByUserGroupIdFromUsersGroupsByDepartments(transactionManager, _userGroupId, start, pageLength, out count);
		}
		
		/// <summary>
		///		Gets Departments objects from the datasource by UserGroupID in the
		///		UsersGroupsByDepartments table. Table Departments is related to table UsersGroups
		///		through the (M:N) relationship defined in the UsersGroupsByDepartments table.
		/// </summary>
		/// <param name="_userGroupId"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of Departments objects.</returns>
		public TList<Departments> GetByUserGroupIdFromUsersGroupsByDepartments(System.Int32 _userGroupId,int start, int pageLength, out int count)
		{
			
			return GetByUserGroupIdFromUsersGroupsByDepartments(null, _userGroupId, start, pageLength, out count);
		}


		/// <summary>
		///		Gets Departments objects from the datasource by UserGroupID in the
		///		UsersGroupsByDepartments table. Table Departments is related to table UsersGroups
		///		through the (M:N) relationship defined in the UsersGroupsByDepartments table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <param name="_userGroupId"></param>
		/// <remarks></remarks>
		/// <returns>Returns a TList of Departments objects.</returns>
		public abstract TList<Departments> GetByUserGroupIdFromUsersGroupsByDepartments(TransactionManager transactionManager,System.Int32 _userGroupId, int start, int pageLength, out int count);
		
		#endregion GetByUserGroupIdFromUsersGroupsByDepartments
		
		#endregion	
		
		#region Delete Methods

		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="transactionManager">A <see cref="TransactionManager"/> object.</param>
		/// <param name="key">The unique identifier of the row to delete.</param>
		/// <returns>Returns true if operation suceeded.</returns>
		public override bool Delete(TransactionManager transactionManager, GPSTrackingDBV2.Entities.DepartmentsKey key)
		{
			return Delete(transactionManager, key.DepartmentId);
		}
		
		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="_departmentId">. Primary Key.</param>
		/// <remarks>Deletes based on primary key(s).</remarks>
		/// <returns>Returns true if operation suceeded.</returns>
		public bool Delete(System.Int32 _departmentId)
		{
			return Delete(null, _departmentId);
		}
		
		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_departmentId">. Primary Key.</param>
		/// <remarks>Deletes based on primary key(s).</remarks>
		/// <returns>Returns true if operation suceeded.</returns>
		public abstract bool Delete(TransactionManager transactionManager, System.Int32 _departmentId);		
		
		#endregion Delete Methods
		
		#region Get By Foreign Key Functions
		#endregion

		#region Get By Index Functions
		
		/// <summary>
		/// 	Gets a row from the DataSource based on its primary key.
		/// </summary>
		/// <param name="transactionManager">A <see cref="TransactionManager"/> object.</param>
		/// <param name="key">The unique identifier of the row to retrieve.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <returns>Returns an instance of the Entity class.</returns>
		public override GPSTrackingDBV2.Entities.Departments Get(TransactionManager transactionManager, GPSTrackingDBV2.Entities.DepartmentsKey key, int start, int pageLength)
		{
			return GetByDepartmentId(transactionManager, key.DepartmentId, start, pageLength);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the primary key PK_Departments_1 index.
		/// </summary>
		/// <param name="_departmentId"></param>
		/// <returns>Returns an instance of the <see cref="GPSTrackingDBV2.Entities.Departments"/> class.</returns>
		public GPSTrackingDBV2.Entities.Departments GetByDepartmentId(System.Int32 _departmentId)
		{
			int count = -1;
			return GetByDepartmentId(null,_departmentId, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_Departments_1 index.
		/// </summary>
		/// <param name="_departmentId"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="GPSTrackingDBV2.Entities.Departments"/> class.</returns>
		public GPSTrackingDBV2.Entities.Departments GetByDepartmentId(System.Int32 _departmentId, int start, int pageLength)
		{
			int count = -1;
			return GetByDepartmentId(null, _departmentId, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_Departments_1 index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_departmentId"></param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="GPSTrackingDBV2.Entities.Departments"/> class.</returns>
		public GPSTrackingDBV2.Entities.Departments GetByDepartmentId(TransactionManager transactionManager, System.Int32 _departmentId)
		{
			int count = -1;
			return GetByDepartmentId(transactionManager, _departmentId, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_Departments_1 index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_departmentId"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="GPSTrackingDBV2.Entities.Departments"/> class.</returns>
		public GPSTrackingDBV2.Entities.Departments GetByDepartmentId(TransactionManager transactionManager, System.Int32 _departmentId, int start, int pageLength)
		{
			int count = -1;
			return GetByDepartmentId(transactionManager, _departmentId, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_Departments_1 index.
		/// </summary>
		/// <param name="_departmentId"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="GPSTrackingDBV2.Entities.Departments"/> class.</returns>
		public GPSTrackingDBV2.Entities.Departments GetByDepartmentId(System.Int32 _departmentId, int start, int pageLength, out int count)
		{
			return GetByDepartmentId(null, _departmentId, start, pageLength, out count);
		}
		
				
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_Departments_1 index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_departmentId"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns an instance of the <see cref="GPSTrackingDBV2.Entities.Departments"/> class.</returns>
		public abstract GPSTrackingDBV2.Entities.Departments GetByDepartmentId(TransactionManager transactionManager, System.Int32 _departmentId, int start, int pageLength, out int count);
						
		#endregion "Get By Index Functions"
	
		#region Custom Methods
		
		
		#endregion

		#region Helper Functions	
		
		/// <summary>
		/// Fill a TList&lt;Departments&gt; From a DataReader.
		/// </summary>
		/// <param name="reader">Datareader</param>
		/// <param name="rows">The collection to fill</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">number of rows.</param>
		/// <returns>a <see cref="TList&lt;Departments&gt;"/></returns>
		public static TList<Departments> Fill(IDataReader reader, TList<Departments> rows, int start, int pageLength)
		{
			NetTiersProvider currentProvider = DataRepository.Provider;
            bool useEntityFactory = currentProvider.UseEntityFactory;
            bool enableEntityTracking = currentProvider.EnableEntityTracking;
            LoadPolicy currentLoadPolicy = currentProvider.CurrentLoadPolicy;
			Type entityCreationFactoryType = currentProvider.EntityCreationalFactoryType;
			
			// advance to the starting row
			for (int i = 0; i < start; i++)
			{
				if (!reader.Read())
				return rows; // not enough rows, just return
			}
			for (int i = 0; i < pageLength; i++)
			{
				if (!reader.Read())
					break; // we are done
					
				string key = null;
				
				GPSTrackingDBV2.Entities.Departments c = null;
				if (useEntityFactory)
				{
					key = new System.Text.StringBuilder("Departments")
					.Append("|").Append((System.Int32)reader[((int)DepartmentsColumn.DepartmentId - 1)]).ToString();
					c = EntityManager.LocateOrCreate<Departments>(
					key.ToString(), // EntityTrackingKey
					"Departments",  //Creational Type
					entityCreationFactoryType,  //Factory used to create entity
					enableEntityTracking); // Track this entity?
				}
				else
				{
					c = new GPSTrackingDBV2.Entities.Departments();
				}
				
				if (!enableEntityTracking ||
					c.EntityState == EntityState.Added ||
					(enableEntityTracking &&
					
						(
							(currentLoadPolicy == LoadPolicy.PreserveChanges && c.EntityState == EntityState.Unchanged) ||
							(currentLoadPolicy == LoadPolicy.DiscardChanges && c.EntityState != EntityState.Unchanged)
						)
					))
				{
					c.SuppressEntityEvents = true;
					c.DepartmentId = (System.Int32)reader[((int)DepartmentsColumn.DepartmentId - 1)];
					c.OriginalDepartmentId = c.DepartmentId;
					c.Name = (System.String)reader[((int)DepartmentsColumn.Name - 1)];
					c.EntityTrackingKey = key;
					c.AcceptChanges();
					c.SuppressEntityEvents = false;
				}
				rows.Add(c);
			}
		return rows;
		}		
		/// <summary>
		/// Refreshes the <see cref="GPSTrackingDBV2.Entities.Departments"/> object from the <see cref="IDataReader"/>.
		/// </summary>
		/// <param name="reader">The <see cref="IDataReader"/> to read from.</param>
		/// <param name="entity">The <see cref="GPSTrackingDBV2.Entities.Departments"/> object to refresh.</param>
		public static void RefreshEntity(IDataReader reader, GPSTrackingDBV2.Entities.Departments entity)
		{
			if (!reader.Read()) return;
			
			entity.DepartmentId = (System.Int32)reader[((int)DepartmentsColumn.DepartmentId - 1)];
			entity.OriginalDepartmentId = (System.Int32)reader["DepartmentID"];
			entity.Name = (System.String)reader[((int)DepartmentsColumn.Name - 1)];
			entity.AcceptChanges();
		}
		
		/// <summary>
		/// Refreshes the <see cref="GPSTrackingDBV2.Entities.Departments"/> object from the <see cref="DataSet"/>.
		/// </summary>
		/// <param name="dataSet">The <see cref="DataSet"/> to read from.</param>
		/// <param name="entity">The <see cref="GPSTrackingDBV2.Entities.Departments"/> object.</param>
		public static void RefreshEntity(DataSet dataSet, GPSTrackingDBV2.Entities.Departments entity)
		{
			DataRow dataRow = dataSet.Tables[0].Rows[0];
			
			entity.DepartmentId = (System.Int32)dataRow["DepartmentID"];
			entity.OriginalDepartmentId = (System.Int32)dataRow["DepartmentID"];
			entity.Name = (System.String)dataRow["Name"];
			entity.AcceptChanges();
		}
		#endregion 
		
		#region DeepLoad Methods
		/// <summary>
		/// Deep Loads the <see cref="IEntity"/> object with criteria based of the child 
		/// property collections only N Levels Deep based on the <see cref="DeepLoadType"/>.
		/// </summary>
		/// <remarks>
		/// Use this method with caution as it is possible to DeepLoad with Recursion and traverse an entire object graph.
		/// </remarks>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="entity">The <see cref="GPSTrackingDBV2.Entities.Departments"/> object to load.</param>
		/// <param name="deep">Boolean. A flag that indicates whether to recursively save all Property Collection that are descendants of this instance. If True, saves the complete object graph below this object. If False, saves this object only. </param>
		/// <param name="deepLoadType">DeepLoadType Enumeration to Include/Exclude object property collections from Load.</param>
		/// <param name="childTypes">GPSTrackingDBV2.Entities.Departments Property Collection Type Array To Include or Exclude from Load</param>
		/// <param name="innerList">A collection of child types for easy access.</param>
	    /// <exception cref="ArgumentNullException">entity or childTypes is null.</exception>
	    /// <exception cref="ArgumentException">deepLoadType has invalid value.</exception>
		public override void DeepLoad(TransactionManager transactionManager, GPSTrackingDBV2.Entities.Departments entity, bool deep, DeepLoadType deepLoadType, System.Type[] childTypes, DeepSession innerList)
		{
			if(entity == null)
				return;
			
			//used to hold DeepLoad method delegates and fire after all the local children have been loaded.
			Dictionary<string, KeyValuePair<Delegate, object>> deepHandles = new Dictionary<string, KeyValuePair<Delegate, object>>();
			// Deep load child collections  - Call GetByDepartmentId methods when available
			
			#region AdministratorsByDepartmentsCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<AdministratorsByDepartments>|AdministratorsByDepartmentsCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'AdministratorsByDepartmentsCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.AdministratorsByDepartmentsCollection = DataRepository.AdministratorsByDepartmentsProvider.GetByDepartmentId(transactionManager, entity.DepartmentId);

				if (deep && entity.AdministratorsByDepartmentsCollection.Count > 0)
				{
					deepHandles.Add("AdministratorsByDepartmentsCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<AdministratorsByDepartments>) DataRepository.AdministratorsByDepartmentsProvider.DeepLoad,
						new object[] { transactionManager, entity.AdministratorsByDepartmentsCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region CompaniesByDepartmentsCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<CompaniesByDepartments>|CompaniesByDepartmentsCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'CompaniesByDepartmentsCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.CompaniesByDepartmentsCollection = DataRepository.CompaniesByDepartmentsProvider.GetByDepartmentId(transactionManager, entity.DepartmentId);

				if (deep && entity.CompaniesByDepartmentsCollection.Count > 0)
				{
					deepHandles.Add("CompaniesByDepartmentsCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<CompaniesByDepartments>) DataRepository.CompaniesByDepartmentsProvider.DeepLoad,
						new object[] { transactionManager, entity.CompaniesByDepartmentsCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region UsersGroupsByDepartmentsCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<UsersGroupsByDepartments>|UsersGroupsByDepartmentsCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'UsersGroupsByDepartmentsCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.UsersGroupsByDepartmentsCollection = DataRepository.UsersGroupsByDepartmentsProvider.GetByDepartmentId(transactionManager, entity.DepartmentId);

				if (deep && entity.UsersGroupsByDepartmentsCollection.Count > 0)
				{
					deepHandles.Add("UsersGroupsByDepartmentsCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<UsersGroupsByDepartments>) DataRepository.UsersGroupsByDepartmentsProvider.DeepLoad,
						new object[] { transactionManager, entity.UsersGroupsByDepartmentsCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region CompanyIdCompaniesCollection_From_CompaniesByDepartments
			// RelationshipType.ManyToMany
			if (CanDeepLoad(entity, "List<Companies>|CompanyIdCompaniesCollection_From_CompaniesByDepartments", deepLoadType, innerList))
			{
				entity.CompanyIdCompaniesCollection_From_CompaniesByDepartments = DataRepository.CompaniesProvider.GetByDepartmentIdFromCompaniesByDepartments(transactionManager, entity.DepartmentId);			 
		
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'CompanyIdCompaniesCollection_From_CompaniesByDepartments' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.CompanyIdCompaniesCollection_From_CompaniesByDepartments != null)
				{
					deepHandles.Add("CompanyIdCompaniesCollection_From_CompaniesByDepartments",
						new KeyValuePair<Delegate, object>((DeepLoadHandle< Companies >) DataRepository.CompaniesProvider.DeepLoad,
						new object[] { transactionManager, entity.CompanyIdCompaniesCollection_From_CompaniesByDepartments, deep, deepLoadType, childTypes, innerList }
					));
				}
			}
			#endregion
			
			
			
			#region AdminUsernameCompanyIdAdministratorsCollection_From_AdministratorsByDepartments
			// RelationshipType.ManyToMany
			if (CanDeepLoad(entity, "List<Administrators>|AdminUsernameCompanyIdAdministratorsCollection_From_AdministratorsByDepartments", deepLoadType, innerList))
			{
				entity.AdminUsernameCompanyIdAdministratorsCollection_From_AdministratorsByDepartments = DataRepository.AdministratorsProvider.GetByDepartmentIdFromAdministratorsByDepartments(transactionManager, entity.DepartmentId);			 
		
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'AdminUsernameCompanyIdAdministratorsCollection_From_AdministratorsByDepartments' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.AdminUsernameCompanyIdAdministratorsCollection_From_AdministratorsByDepartments != null)
				{
					deepHandles.Add("AdminUsernameCompanyIdAdministratorsCollection_From_AdministratorsByDepartments",
						new KeyValuePair<Delegate, object>((DeepLoadHandle< Administrators >) DataRepository.AdministratorsProvider.DeepLoad,
						new object[] { transactionManager, entity.AdminUsernameCompanyIdAdministratorsCollection_From_AdministratorsByDepartments, deep, deepLoadType, childTypes, innerList }
					));
				}
			}
			#endregion
			
			
			
			#region UserGroupIdUsersGroupsCollection_From_UsersGroupsByDepartments
			// RelationshipType.ManyToMany
			if (CanDeepLoad(entity, "List<UsersGroups>|UserGroupIdUsersGroupsCollection_From_UsersGroupsByDepartments", deepLoadType, innerList))
			{
				entity.UserGroupIdUsersGroupsCollection_From_UsersGroupsByDepartments = DataRepository.UsersGroupsProvider.GetByDepartmentIdFromUsersGroupsByDepartments(transactionManager, entity.DepartmentId);			 
		
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'UserGroupIdUsersGroupsCollection_From_UsersGroupsByDepartments' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.UserGroupIdUsersGroupsCollection_From_UsersGroupsByDepartments != null)
				{
					deepHandles.Add("UserGroupIdUsersGroupsCollection_From_UsersGroupsByDepartments",
						new KeyValuePair<Delegate, object>((DeepLoadHandle< UsersGroups >) DataRepository.UsersGroupsProvider.DeepLoad,
						new object[] { transactionManager, entity.UserGroupIdUsersGroupsCollection_From_UsersGroupsByDepartments, deep, deepLoadType, childTypes, innerList }
					));
				}
			}
			#endregion
			
			
			
			//Fire all DeepLoad Items
			foreach(KeyValuePair<Delegate, object> pair in deepHandles.Values)
		    {
                pair.Key.DynamicInvoke((object[])pair.Value);
		    }
			deepHandles = null;
		}
		
		#endregion 
		
		#region DeepSave Methods

		/// <summary>
		/// Deep Save the entire object graph of the GPSTrackingDBV2.Entities.Departments object with criteria based of the child 
		/// Type property array and DeepSaveType.
		/// </summary>
		/// <param name="transactionManager">The transaction manager.</param>
		/// <param name="entity">GPSTrackingDBV2.Entities.Departments instance</param>
		/// <param name="deepSaveType">DeepSaveType Enumeration to Include/Exclude object property collections from Save.</param>
		/// <param name="childTypes">GPSTrackingDBV2.Entities.Departments Property Collection Type Array To Include or Exclude from Save</param>
		/// <param name="innerList">A Hashtable of child types for easy access.</param>
		public override bool DeepSave(TransactionManager transactionManager, GPSTrackingDBV2.Entities.Departments entity, DeepSaveType deepSaveType, System.Type[] childTypes, DeepSession innerList)
		{	
			if (entity == null)
				return false;
							
			#region Composite Parent Properties
			//Save Source Composite Properties, however, don't call deep save on them.  
			//So they only get saved a single level deep.
			#endregion Composite Parent Properties

			// Save Root Entity through Provider
			if (!entity.IsDeleted)
				this.Save(transactionManager, entity);
			
			//used to hold DeepSave method delegates and fire after all the local children have been saved.
			Dictionary<string, KeyValuePair<Delegate, object>> deepHandles = new Dictionary<string, KeyValuePair<Delegate, object>>();

			#region CompanyIdCompaniesCollection_From_CompaniesByDepartments>
			if (CanDeepSave(entity.CompanyIdCompaniesCollection_From_CompaniesByDepartments, "List<Companies>|CompanyIdCompaniesCollection_From_CompaniesByDepartments", deepSaveType, innerList))
			{
				if (entity.CompanyIdCompaniesCollection_From_CompaniesByDepartments.Count > 0 || entity.CompanyIdCompaniesCollection_From_CompaniesByDepartments.DeletedItems.Count > 0)
				{
					DataRepository.CompaniesProvider.Save(transactionManager, entity.CompanyIdCompaniesCollection_From_CompaniesByDepartments); 
					deepHandles.Add("CompanyIdCompaniesCollection_From_CompaniesByDepartments",
						new KeyValuePair<Delegate, object>((DeepSaveHandle<Companies>) DataRepository.CompaniesProvider.DeepSave,
						new object[] { transactionManager, entity.CompanyIdCompaniesCollection_From_CompaniesByDepartments, deepSaveType, childTypes, innerList }
					));
				}
			}
			#endregion 

			#region AdminUsernameCompanyIdAdministratorsCollection_From_AdministratorsByDepartments>
			if (CanDeepSave(entity.AdminUsernameCompanyIdAdministratorsCollection_From_AdministratorsByDepartments, "List<Administrators>|AdminUsernameCompanyIdAdministratorsCollection_From_AdministratorsByDepartments", deepSaveType, innerList))
			{
				if (entity.AdminUsernameCompanyIdAdministratorsCollection_From_AdministratorsByDepartments.Count > 0 || entity.AdminUsernameCompanyIdAdministratorsCollection_From_AdministratorsByDepartments.DeletedItems.Count > 0)
				{
					DataRepository.AdministratorsProvider.Save(transactionManager, entity.AdminUsernameCompanyIdAdministratorsCollection_From_AdministratorsByDepartments); 
					deepHandles.Add("AdminUsernameCompanyIdAdministratorsCollection_From_AdministratorsByDepartments",
						new KeyValuePair<Delegate, object>((DeepSaveHandle<Administrators>) DataRepository.AdministratorsProvider.DeepSave,
						new object[] { transactionManager, entity.AdminUsernameCompanyIdAdministratorsCollection_From_AdministratorsByDepartments, deepSaveType, childTypes, innerList }
					));
				}
			}
			#endregion 

			#region UserGroupIdUsersGroupsCollection_From_UsersGroupsByDepartments>
			if (CanDeepSave(entity.UserGroupIdUsersGroupsCollection_From_UsersGroupsByDepartments, "List<UsersGroups>|UserGroupIdUsersGroupsCollection_From_UsersGroupsByDepartments", deepSaveType, innerList))
			{
				if (entity.UserGroupIdUsersGroupsCollection_From_UsersGroupsByDepartments.Count > 0 || entity.UserGroupIdUsersGroupsCollection_From_UsersGroupsByDepartments.DeletedItems.Count > 0)
				{
					DataRepository.UsersGroupsProvider.Save(transactionManager, entity.UserGroupIdUsersGroupsCollection_From_UsersGroupsByDepartments); 
					deepHandles.Add("UserGroupIdUsersGroupsCollection_From_UsersGroupsByDepartments",
						new KeyValuePair<Delegate, object>((DeepSaveHandle<UsersGroups>) DataRepository.UsersGroupsProvider.DeepSave,
						new object[] { transactionManager, entity.UserGroupIdUsersGroupsCollection_From_UsersGroupsByDepartments, deepSaveType, childTypes, innerList }
					));
				}
			}
			#endregion 
	
			#region List<AdministratorsByDepartments>
				if (CanDeepSave(entity.AdministratorsByDepartmentsCollection, "List<AdministratorsByDepartments>|AdministratorsByDepartmentsCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(AdministratorsByDepartments child in entity.AdministratorsByDepartmentsCollection)
					{
						if(child.DepartmentIdSource != null)
						{
								child.DepartmentId = child.DepartmentIdSource.DepartmentId;
						}

						if(child.AdminUsernameCompanyIdSource != null)
						{
								child.AdminUsername = child.AdminUsernameCompanyIdSource.AdminUsername;
								child.CompanyId = child.AdminUsernameCompanyIdSource.CompanyId;
						}

					}

					if (entity.AdministratorsByDepartmentsCollection.Count > 0 || entity.AdministratorsByDepartmentsCollection.DeletedItems.Count > 0)
					{
						//DataRepository.AdministratorsByDepartmentsProvider.Save(transactionManager, entity.AdministratorsByDepartmentsCollection);
						
						deepHandles.Add("AdministratorsByDepartmentsCollection",
						new KeyValuePair<Delegate, object>((DeepSaveHandle< AdministratorsByDepartments >) DataRepository.AdministratorsByDepartmentsProvider.DeepSave,
							new object[] { transactionManager, entity.AdministratorsByDepartmentsCollection, deepSaveType, childTypes, innerList }
						));
					}
				} 
			#endregion 
				
	
			#region List<CompaniesByDepartments>
				if (CanDeepSave(entity.CompaniesByDepartmentsCollection, "List<CompaniesByDepartments>|CompaniesByDepartmentsCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(CompaniesByDepartments child in entity.CompaniesByDepartmentsCollection)
					{
						if(child.DepartmentIdSource != null)
						{
								child.DepartmentId = child.DepartmentIdSource.DepartmentId;
						}

						if(child.CompanyIdSource != null)
						{
								child.CompanyId = child.CompanyIdSource.CompanyId;
						}

					}

					if (entity.CompaniesByDepartmentsCollection.Count > 0 || entity.CompaniesByDepartmentsCollection.DeletedItems.Count > 0)
					{
						//DataRepository.CompaniesByDepartmentsProvider.Save(transactionManager, entity.CompaniesByDepartmentsCollection);
						
						deepHandles.Add("CompaniesByDepartmentsCollection",
						new KeyValuePair<Delegate, object>((DeepSaveHandle< CompaniesByDepartments >) DataRepository.CompaniesByDepartmentsProvider.DeepSave,
							new object[] { transactionManager, entity.CompaniesByDepartmentsCollection, deepSaveType, childTypes, innerList }
						));
					}
				} 
			#endregion 
				
	
			#region List<UsersGroupsByDepartments>
				if (CanDeepSave(entity.UsersGroupsByDepartmentsCollection, "List<UsersGroupsByDepartments>|UsersGroupsByDepartmentsCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(UsersGroupsByDepartments child in entity.UsersGroupsByDepartmentsCollection)
					{
						if(child.DepartmentIdSource != null)
						{
								child.DepartmentId = child.DepartmentIdSource.DepartmentId;
						}

						if(child.UserGroupIdSource != null)
						{
								child.UserGroupId = child.UserGroupIdSource.UserGroupId;
						}

					}

					if (entity.UsersGroupsByDepartmentsCollection.Count > 0 || entity.UsersGroupsByDepartmentsCollection.DeletedItems.Count > 0)
					{
						//DataRepository.UsersGroupsByDepartmentsProvider.Save(transactionManager, entity.UsersGroupsByDepartmentsCollection);
						
						deepHandles.Add("UsersGroupsByDepartmentsCollection",
						new KeyValuePair<Delegate, object>((DeepSaveHandle< UsersGroupsByDepartments >) DataRepository.UsersGroupsByDepartmentsProvider.DeepSave,
							new object[] { transactionManager, entity.UsersGroupsByDepartmentsCollection, deepSaveType, childTypes, innerList }
						));
					}
				} 
			#endregion 
				
			//Fire all DeepSave Items
			foreach(KeyValuePair<Delegate, object> pair in deepHandles.Values)
		    {
                pair.Key.DynamicInvoke((object[])pair.Value);
		    }
			
			// Save Root Entity through Provider, if not already saved in delete mode
			if (entity.IsDeleted)
				this.Save(transactionManager, entity);
				

			deepHandles = null;
						
			return true;
		}
		#endregion
	} // end class
	
	#region DepartmentsChildEntityTypes
	
	///<summary>
	/// Enumeration used to expose the different child entity types 
	/// for child properties in <c>GPSTrackingDBV2.Entities.Departments</c>
	///</summary>
	public enum DepartmentsChildEntityTypes
	{

		///<summary>
		/// Collection of <c>Departments</c> as OneToMany for AdministratorsByDepartmentsCollection
		///</summary>
		[ChildEntityType(typeof(TList<AdministratorsByDepartments>))]
		AdministratorsByDepartmentsCollection,

		///<summary>
		/// Collection of <c>Departments</c> as OneToMany for CompaniesByDepartmentsCollection
		///</summary>
		[ChildEntityType(typeof(TList<CompaniesByDepartments>))]
		CompaniesByDepartmentsCollection,

		///<summary>
		/// Collection of <c>Departments</c> as OneToMany for UsersGroupsByDepartmentsCollection
		///</summary>
		[ChildEntityType(typeof(TList<UsersGroupsByDepartments>))]
		UsersGroupsByDepartmentsCollection,

		///<summary>
		/// Collection of <c>Departments</c> as ManyToMany for CompaniesCollection_From_CompaniesByDepartments
		///</summary>
		[ChildEntityType(typeof(TList<Companies>))]
		CompanyIdCompaniesCollection_From_CompaniesByDepartments,

		///<summary>
		/// Collection of <c>Departments</c> as ManyToMany for AdministratorsCollection_From_AdministratorsByDepartments
		///</summary>
		[ChildEntityType(typeof(TList<Administrators>))]
		AdminUsernameCompanyIdAdministratorsCollection_From_AdministratorsByDepartments,

		///<summary>
		/// Collection of <c>Departments</c> as ManyToMany for UsersGroupsCollection_From_UsersGroupsByDepartments
		///</summary>
		[ChildEntityType(typeof(TList<UsersGroups>))]
		UserGroupIdUsersGroupsCollection_From_UsersGroupsByDepartments,
	}
	
	#endregion DepartmentsChildEntityTypes
	
	#region DepartmentsFilterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="SqlFilterBuilder&lt;DepartmentsColumn&gt;"/> class
	/// that is used exclusively with a <see cref="Departments"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class DepartmentsFilterBuilder : SqlFilterBuilder<DepartmentsColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the DepartmentsFilterBuilder class.
		/// </summary>
		public DepartmentsFilterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the DepartmentsFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public DepartmentsFilterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the DepartmentsFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public DepartmentsFilterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion DepartmentsFilterBuilder
	
	#region DepartmentsParameterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="ParameterizedSqlFilterBuilder&lt;DepartmentsColumn&gt;"/> class
	/// that is used exclusively with a <see cref="Departments"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class DepartmentsParameterBuilder : ParameterizedSqlFilterBuilder<DepartmentsColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the DepartmentsParameterBuilder class.
		/// </summary>
		public DepartmentsParameterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the DepartmentsParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public DepartmentsParameterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the DepartmentsParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public DepartmentsParameterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion DepartmentsParameterBuilder
	
	#region DepartmentsSortBuilder
    
    /// <summary>
    /// A strongly-typed instance of the <see cref="SqlSortBuilder&lt;DepartmentsColumn&gt;"/> class
	/// that is used exclusively with a <see cref="Departments"/> object.
    /// </summary>
    [CLSCompliant(true)]
    public class DepartmentsSortBuilder : SqlSortBuilder<DepartmentsColumn>
    {
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the DepartmentsSqlSortBuilder class.
		/// </summary>
		public DepartmentsSortBuilder() : base() { }

		#endregion Constructors

    }    
    #endregion DepartmentsSortBuilder
	
} // end namespace
